package cn.dto;

import java.util.Arrays;
import java.util.List;

/**
 * Created by Kuexun on 2018/8/11.
 */
public class Result<T> {
    private int code;
    private int total;
    //userInfo 返回
    private String id;
    private String name;
    private String avatar;

    //goodsItems 返回
    private boolean hasMore;
    private List<T> items;

    //detail 返回
    private T item;

    //uploadImg 返回
    private String[] picture;

    public Result(int code, String id, String name, String avatar) {
        this.code = code;
        this.id = id;
        this.name = name;
        this.avatar = avatar;
    }

    public Result(int code, boolean hasMore, List<T> items) {
        this.code = code;
        this.hasMore = hasMore;
        this.items = items;
    }

    public Result(int code, T item) {
        this.code = code;
        this.item = item;
    }

    public Result(int code, String[] picture) {
        this.code = code;
        this.picture = picture;
    }

    public Result(int code) {
        this.code = code;
    }

    public Result(int code, int total,List<T> items) {
        this.code = code;
        this.total = total;
        this.items = items;
    }

    @Override
    public String toString() {
        return "Result{" +
                "code=" + code +
                ", total=" + total +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", avatar='" + avatar + '\'' +
                ", hasMore=" + hasMore +
                ", items=" + items +
                ", item=" + item +
                ", picture=" + Arrays.toString(picture) +
                '}';
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public boolean isHasMore() {
        return hasMore;
    }

    public void setHasMore(boolean hasMore) {
        this.hasMore = hasMore;
    }

    public List<T> getItems() {
        return items;
    }

    public void setItems(List<T> items) {
        this.items = items;
    }

    public T getItem() {
        return item;
    }

    public void setItem(T item) {
        this.item = item;
    }

    public String[] getPicture() {
        return picture;
    }

    public void setPicture(String[] picture) {
        this.picture = picture;
    }
}
